// CellInfo.h: interface for the CCellInfo class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_CELLINFO_H__AC3A14CC_E263_45C3_95CC_DCC76EDB13FB__INCLUDED_)
#define AFX_CELLINFO_H__AC3A14CC_E263_45C3_95CC_DCC76EDB13FB__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

extern COLORREF ANSI_COLOR_TO_RGB[16];

enum enumANSI_COLORS
{
	COLOR_BLACK		= 0,
	COLOR_RED		= 1,
	COLOR_GEREN		= 2,
	COLOR_YELLOW	= 3,
	COLOR_BLUE		= 4,
	COLOR_PINK		= 5,
	COLOR_CYAN		= 6,
	COLOR_GRAY		= 7,
};

enum enumANSI_FONT
{
	FONT_DEFAULT	= 0,
	FONT_SONG		= 1,
	FONT_HEI		= 2,
	FONT_KAI		= 3,
	FONT_SEAMLESS	= 4
};


typedef enum{
	PASTE_NORMAL		= 0x00,
	PASTE_IGNORE_BACK	= 0x01,
	PASTE_IGNORE_FORE	= 0x02,
	PASTE_IGNORE_ALL	= 0x04,
} enumPasteType;

typedef enum enumnCharType{
	CHAR_NORMAL = 0x00,
	CHAR_GBK_1ST = 0x01,
	CHAR_GBK_2ND = 0x02
} CHAR_TYPE;

extern CString gFontNames[5];//[20];

typedef int ANSI_COLOR;
typedef int ANSI_FONT;

class CCellInfo
{
public:
	BOOL operator != (const CCellInfo &rhs)
	{
		if((nForeColor != rhs.nForeColor) ||
		   (nBackColor != rhs.nBackColor) ||
		   (bHighLight != rhs.bHighLight) ||
		   (bBlink     != rhs.bBlink)     ||
		   (bUnderLine != rhs.bUnderLine) ||
		   (bReverse   != rhs.bReverse)   ||
		   (nFontIndex != rhs.nFontIndex) )
		{
			return TRUE;
		}
		return FALSE;
	}
	BOOL operator == (const CCellInfo &rhs)
	{
		return !(operator !=)(rhs);
	}

	void CopyTo(CCellInfo &rhs, BOOL bForeTransparent, BOOL bBackTransparent)
	{
		rhs.bBlink = bBlink;
		rhs.bUnderLine = bUnderLine;
		rhs.bReverse = bReverse;
		rhs.nFontIndex = nFontIndex;
		if(!bForeTransparent)
		{
			rhs.bHighLight = bHighLight;
			rhs.nForeColor = nForeColor;
		}
		if(!bBackTransparent)
		{
			rhs.nBackColor = nBackColor;
		}
	}
	void SetForeColor(int newForeColor)
	{
		nForeColor = newForeColor % 8;
		bHighLight = newForeColor / 8;
	}
	void SetForeColor(CCellInfo &rCellInfo)
	{
		nForeColor = rCellInfo.nForeColor;
		bHighLight = rCellInfo.bHighLight;
	}
	int GetForeColor()
	{
		return nForeColor + bHighLight * 8;
	}
	//
	ANSI_FONT GetFontIndex();
	//
	CString GetSpanAttributes();

	BOOL bBlink;
	BOOL bUnderLine;
	BOOL bReverse;
	BOOL bHighLight;

	ANSI_COLOR nBackColor;
	ANSI_COLOR nForeColor;

	ANSI_FONT nFontIndex;
	BOOL bSelected;
	CHAR_TYPE charType;
	BOOL bSeamlessChar;
public:
	CString GetDiffEscText(const CCellInfo &prevCell);
	BOOL ParseEscText(CString sEscText);
	COLORREF GetRgbForeColor();
	COLORREF GetRgbBackColor();
	void ResetDefault();

	CCellInfo();
	~CCellInfo();
protected:
	
};

#endif // !defined(AFX_CELLINFO_H__AC3A14CC_E263_45C3_95CC_DCC76EDB13FB__INCLUDED_)
